Package org.battlestar.engine

Source Code of org.battlestar.engine.MyFirstTest

package org.battlestar.engine;

import static org.junit.Assert.*;
import org.junit.Test;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Query;
import static com.google.appengine.api.datastore.FetchOptions.Builder.withLimit;;


public class MyFirstTest extends LocalDataTestBase2GAE{

    // run this test twice to prove we're not leaking any state across tests
    private void doTest() {
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        assertEquals(0, ds.prepare(new Query("yam")).countEntities(withLimit(10)));
        ds.put(new Entity("yam"));
        ds.put(new Entity("yam"));
        assertEquals(2, ds.prepare(new Query("yam")).countEntities(withLimit(10)));
    }
 
  @Test
  public void testAddition() {
    assertEquals(4, 2 + 2);
  }
 
  @Test
  public void testInsert1(){
    doTest();
  }
 
  @Test
  public void testInsert2(){
    doTest();
  }
}
TOP

Related Classes of org.battlestar.engine.MyFirstTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.